﻿#region Using directives

using System;
using System.Collections.Generic;
using System.Text;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using Weazel.NativeMath;

#endregion

namespace Weazel.NativeMath.Test
{
	[TestClass]
	public class TestSignedComparsion
	{
		/**************************************************************************
		 * Equals operator (==)
		 **************************************************************************/
		[TestMethod]
		public void TestEquals_1()
		{
			Assert.IsTrue(new Integer(8, 0, true) == new Integer(8, 0, true));
		}
		[TestMethod]
		public void TestEquals_2()
		{
			Assert.IsTrue(new Integer(8, 10, true) == new Integer(8, 10, true));
		}
		[TestMethod]
		public void TestEquals_3()
		{
			Assert.IsTrue(new Integer(8, -10, true) == new Integer(8, -10, true));
		}
		[TestMethod]
		public void TestEquals_4()
		{
			Assert.IsTrue(new Integer(8, 0, true) == new Integer(100, 0, true));
		}
		[TestMethod]
		public void TestEquals_5()
		{
			Assert.IsTrue(new Integer(8, 10, true) == new Integer(100, 10, true));
		}
		[TestMethod]
		public void TestEquals_6()
		{
			Assert.IsTrue(new Integer(8, -10, true) == new Integer(100, -10, true));
		}
		[TestMethod]
		public void TestEquals_7()
		{
			Integer a = new Integer(64, "0xff00001111", false);
			Integer b = new Integer(8, 67, false);

			Assert.IsFalse(a == b);
		}
		[TestMethod]
		public void TestEquals_8()
		{
			Integer a = new Integer(64, "67", true);
			Integer b = new Integer(8, 67, false);

			Assert.IsTrue(a == b);
		}

		[TestMethod]
		public void TestEquals_9()
		{
			Integer a = new Integer(64, "100", true);
			Integer b = new Integer(8, 67, false);

			Assert.IsFalse(a == b);
		}

		/**************************************************************************
		 * Not equals operator (!=)
		 **************************************************************************/
		[TestMethod]
		public void TestNotEquals_1()
		{
			Assert.IsFalse(new Integer(8, 0, true) != new Integer(8, 0, true));
		}
		[TestMethod]
		public void TestNotEquals_2()
		{
			Assert.IsFalse(new Integer(8, 10, true) != new Integer(8, 10, true));
		}
		[TestMethod]
		public void TestNotEquals_3()
		{
			Assert.IsFalse(new Integer(8, -10, true) != new Integer(8, -10, true));
		}
		[TestMethod]
		public void TestNotEquals_4()
		{
			Assert.IsFalse(new Integer(8, 0, true) != new Integer(100, 0, true));
		}
		[TestMethod]
		public void TestNotEquals_5()
		{
			Assert.IsFalse(new Integer(8, 10, true) != new Integer(100, 10, true));
		}
		[TestMethod]
		public void TestNotEquals_6()
		{
			Assert.IsFalse(new Integer(8, -10, true) != new Integer(100, -10, true));
		}
		[TestMethod]
		public void TestNotEquals_7()
		{
			Integer a = new Integer(32, 10, true);
			Integer b = new Integer(32, 10, false);
			Assert.IsFalse(a != b);
		}
		[TestMethod]
		public void TestNotEquals_8()
		{
			Integer a = new Integer(32, 100, true);
			Integer b = new Integer(32, 10, false);
			Assert.IsTrue(a != b);
		}

		/**************************************************************************
		 * Greater than operator (>)
		 **************************************************************************/
		[TestMethod]
		public void TestGreaterThan_1()
		{
			Assert.IsTrue(new Integer(8, 1, true) > new Integer(8, 0, true));
		}

		[TestMethod]
		public void TestGreaterThan_2()
		{
			Assert.IsTrue(new Integer(8, 100, true) > new Integer(8, 10, true));
		}

		[TestMethod]
		public void TestGreaterThan_3()
		{
			Assert.IsTrue(new Integer(8, 10, true) > new Integer(8, -10, true));
		}

		[TestMethod]
		public void TestGreaterThan_4()
		{
			Assert.IsTrue(new Integer(8, -10, true) > new Integer(8, -100, true));
		}

		[TestMethod]
		public void TestGreaterThan_5()
		{
			Assert.IsTrue(new Integer(8, 1, true) > new Integer(100, 0, true));
		}

		[TestMethod]
		public void TestGreaterThan_6()
		{
			Assert.IsTrue(new Integer(100, 1, true) > new Integer(8, 0, true));
		}

		[TestMethod]
		public void TestGreaterThan_7()
		{
			Integer a = new Integer(32, 10, true);
			Integer b = new Integer(32, 10, false);

			Assert.IsFalse(a > b);
		}

		[TestMethod]
		public void TestGreaterThan_8()
		{
			Integer a = new Integer(32, 11, true);
			Integer b = new Integer(32, 10, false);

			Assert.IsTrue(a > b);
		}

		/**************************************************************************
		 * Less than operator (<) (implemented using greater than)
		 **************************************************************************/
		[TestMethod]
		public void TestLessThan_1()
		{
			Integer a = new Integer(32, 11, true);
			Integer b = new Integer(32, 10, false);

			Assert.IsFalse(a < b);
			Assert.IsTrue(b < a);
		}
	}
}
